package com.xsd.prototype.deep;

/**
 * @Description:
 * @Author: zhoufuzong
 * @Created: 2021-02-11 11:51:59
 * @Version: 1.1.0
 */

public class Client {
    public static void main(String[] args) throws CloneNotSupportedException {
        DeepProtoType p = new DeepProtoType();
        p.name="张三";
        p.deepCloneTarget = new DeepCloneTarget("大牛","小牛");

        // 方式1 完成深拷贝
//        DeepProtoType p2 = (DeepProtoType)p.clone();
//        System.out.println("p.name=" + p.name + "p.deepCloneableTarget=" + p.deepCloneTarget.hashCode());
//		System.out.println("p2.name=" + p.name + "p2.deepCloneableTarget=" + p2.deepCloneTarget.hashCode());


		// 方式2 完成深拷贝
        DeepProtoType p2 = (DeepProtoType)p.clone();
        System.out.println("p.name=" + p.name + "p.deepCloneableTarget=" + p.deepCloneTarget.hashCode());
        System.out.println("p2.name=" + p.name + "p2.deepCloneableTarget=" + p2.deepCloneTarget.hashCode());

    }
}
